//
//  ViewController.m
//  B_object
//
//  Created by dllo on 15/10/27.
//  Copyright © 2015年 YUHAO. All rights reserved.
//

#import "MainViewController.h"
#import "AppDelegate.h"
#import <AFNetworking.h>

@interface MainViewController ()

@end

@implementation MainViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(leftAction)];
    
    self.title = @"main";
    
    self.view.backgroundColor = [UIColor redColor];
    
    
}

- (void)leftAction
{
    
    AppDelegate *appD = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    if (appD.leftSlideVC.closed) {
        [appD.leftSlideVC openLeftView];
    }else{
        [appD.leftSlideVC closeLeftView];
    }
    
}

- (void)dataHandler
{
    AFHTTPSessionManager *session = [AFHTTPSessionManager manager];
    [session GET:@"请求的url" parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
        
        NSData *data = [NSJSONSerialization dataWithJSONObject:responseObject options:NSJSONWritingPrettyPrinted error:nil];
        
        
        NSLog(@"成功");
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        NSLog(@"失败");
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
